# -*- coding: utf-8 -*-
# @Time    : 2023/6/5 20:26
# @Author  : hyh
# @Email   : 935887145@qq.com
# @File    : edit_profile_page.py
# @Software: PyCharm
from pages.base_page import BasePage
from appium import webdriver
from tools import driver
from appium.webdriver.common.mobileby import MobileBy as By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import  expected_conditions as EC
class EditProfilePage(BasePage):
    add_locator = (By.XPATH,'//*[@resource-id="com.xiachufang:id/main_profile_desc_tv"]')
    edit_locator = (By.ANDROID_UIAUTOMATOR,'new UiSelector().className(\"android.widget.ImageView\").resourceId(\"com.xiachufang:id/navigation_img_view\")')
    bianji_locator = (By.XPATH,'//*[@resource-id="com.xiachufang:id/edit_user_config"]')
    text_locator = (By.XPATH,'//*[@resource-id="com.xiachufang:id/navigation_bar_title_layout"]')

    def click_add(self):
        self.find_element(self.add_locator).click() #点击添加个人简介
    def click_edit(self):
        self.find_element(self.edit_locator).click() #点击右上角铅笔
    def click_bianji(self):
        self.find_element(self.bianji_locator).click() #点击编辑个人资料
    def get_text(self):
        current_text = self.find_element(self.text_locator).get_attribute('text') #获取文本
        return current_text